package com.hula.loan4u.utils;

import android.content.Context;
import android.content.SharedPreferences;

public class SPUtil {

	private final static String NAME = "com.util.sputil";
	private static SharedPreferences saveInfo;
	private static SharedPreferences.Editor saveEditor;

	public static void init(Context mContext) {
		if (saveInfo == null) {
			saveInfo = mContext
					.getSharedPreferences(NAME, Context.MODE_PRIVATE);
			saveEditor = saveInfo.edit();
		}
	}

	public static boolean putString(String key, String value) {
		saveEditor.putString(key, value);
		return saveEditor.commit();
	}

	public static boolean putBoolean(String key, boolean value) {
		saveEditor.putBoolean(key, value);
		return saveEditor.commit();
	}

	public static String getString(String key) {
		return saveInfo.getString(key, "");
	}
	public static boolean getBoolean(String key) {
		return saveInfo.getBoolean(key, false);
	}

}
